<html  xmlns:th="http://www.thymeleaf.org" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v="http://www.w3.org/1999/xhtml" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0"/>
    <title>dati</title>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>


</head>
<body>
<style>
    .navbar{
        background: #d2edf4;
        background-image: linear-gradient(to bottom, #d0edf5, #e1e5f0 100%);
    }
    .container{
        max-width: 1000px;
        min-height: 100%;
        background-color: transparent;
    }
</style>
<script src="/js/common.js"></script>
<script src="https://cdn.jsdelivr.net/vue.resource/1.2.1/vue-resource.min.js"></script>
<script src="https://cdn.bootcss.com/vue-router/3.0.1/vue-router.js"></script>
<div class="container" id="app" >

    <div class="post">
        <div class="form-group">
            <label>名称</label>
            <input type="text" class="form-control" v-model="typeName">
        </div>
        <button  class="btn btn-primary  btn-block" v-on:click="editFresh()">修改</button>
    </div>

    <!--  </div>-->
</div>
<script th:inline="javascript">
    var typeID=[[${typeID}]];
    var typeName=[[${typeName}]];

    var app = new Vue({
        el: '#app',
        data: {
            typeName: typeName,
        },
        methods: {
            editFresh:function () {
                var params={
                    typeName:app.typeName,
                    typeID:typeID
                };
                $.ajax({
                    type : "post",
                    url : "/user/editType",
                    data : params,
                    success : function(data) {
                        if(data.code==200){
                            alert("修改成功");
                        }
                        else if(data.code==404){
                            alert("失败");
                        }
                        else {
                            alert("连接错误");
                        }
                        location.href="/toType";
                    }
                });
            }
        }
    });
</script>
</body>
</html>
